import type {
  patientMedicineOrderApi,
  patientMedicineOrderDetailApi,
  patientMedicineOrderPreApi,
  patientMedicineOrderReq,
  patientOrderAddressApi,
  patientOrderLogisticsApi
} from '@/types/order'
import request from '@/utils/request'

export const patientMedicineOrderPre = (id: string) =>
  request<patientMedicineOrderPreApi>('/patient/medicine/order/pre', 'get', {
    prescriptionId: id
  })

// 收货地址
export const patientOrderAddress = () => request<patientOrderAddressApi[]>('/patient/order/address')

// 产生药品 订单
export const patientMedicineOrder = (data: patientMedicineOrderReq) =>
  request<patientMedicineOrderApi>('/patient/medicine/order', 'post', data)

// 订单详情
export const patientMedicineOrderDetail = (id: string) =>
  request<patientMedicineOrderDetailApi>(`/patient/medicine/order/detail/${id}`)

// 物流详情
export const patientOrderLogistics = (id: string) =>
  request<patientOrderLogisticsApi>(`/patient/order/${id}/logistics`)
